﻿//checked
namespace net.entity.framework.query {
    public sealed class QueryState {
        #region Members

        private readonly QueryRoot[] selectRoots;
        private readonly bool distinct;
        private readonly int top;
        private readonly QueryClause whereClause;
        private readonly Terminal[] groupByRoots;
        private readonly QueryClause havingClause;
        private readonly QueryBuilder[] nestedFroms;
        private readonly Terminal[] orderByRoots;

        #endregion

        #region Properties

        public QueryRoot[] SelectRoots {
            get { return selectRoots; }
        }

        public bool Distinct {
            get { return distinct; }
        }

        public int Top {
            get { return top; }
        }

        public QueryClause WhereClause {
            get { return whereClause; }
        }

        public Terminal[] GroupByRoots {
            get { return groupByRoots; }
        }

        public QueryClause HavingClause {
            get { return havingClause; }
        }

        public QueryBuilder[] NestedFroms {
            get { return nestedFroms; }
        }

        public Terminal[] OrderByRoots {
            get { return orderByRoots; }
        }

        #endregion

        #region Constructors

        public QueryState(QueryRoot[] selectRoots, bool distinct,
                          int top, QueryClause whereClause, Terminal[] groupByRoots,
                          QueryClause havingClause, QueryBuilder[] nestedFroms, Terminal[] orderByRoots) {
            this.selectRoots = selectRoots;
            this.distinct = distinct;
            this.top = top;
            this.whereClause = whereClause;
            this.groupByRoots = groupByRoots;
            this.havingClause = havingClause;
            this.nestedFroms = nestedFroms;
            this.orderByRoots = orderByRoots;
        }

        #endregion
    }
}